// types.ts

export interface TAB {
  id: string | number;
  label: string;
  icon: string;
}
// 选项卡数据结构
export interface TabItem {
  id: number | string;
  label: string;
  icon: string;
  title: string;
}

export interface ApiData {
  id: number | string;
  updateTime?: string;
  approvalStatus?: string;
  orderId?: string;
  notificationTime?: string;
  status: string;
  content?: string;
  versionUpdateTime?: string;
  versionStatus?: string;
  versionDescription?: string;
  create_time: string;
  orderNo?: string;
  type: string;
  name?: string;
  text?: string;
}

export interface FormattedItem {
  id: number | string;
  type: string;
  date: string;
  status?: string;
  statusClass?: string;
  description?: string;
  name?: string;
  text?: string;
}

// keyToChinese.ts

type KeyToChineseMapping = {
  [key: string]: string;
};

export const keyToChinese: KeyToChineseMapping = {
  type: '工单类型',
  orderNo: '工单编号',
  create_phone: '用户账户',
  creationName: '申请人',
  create_time: '申请时间',
  do_time: '处理时间',
  content: '申请内容',
  remark: '申请原因',
  is_do: '处理回执',
};

export function transformKeysToChinese(content: { [key: string]: any }): {
  [key: string]: any;
} {
  const translatedContent: { [key: string]: any } = {};

  for (let key in content) {
    if (keyToChinese[key]) {
      translatedContent[keyToChinese[key]] = content[key];
    } else {
      translatedContent[key] = content[key];
    }
  }

  return translatedContent;
}
